home *** CD-ROM | disk | FTP | other *** search
- #! /bin/sh
- # postinst script for hplip
- # $Id: hplip.postinst,v 1.1 2005/10/15 21:39:04 hmh Exp $
- #
- # see: dh_installdeb(1)
-
- set -e
-
- # summary of how this script can be called:
- # * <postinst> `configure' <most-recently-configured-version>
- # * <old-postinst> `abort-upgrade' <new version>
- # * <conflictor's-postinst> `abort-remove' `in-favour' <package>
- # <new-version>
- # * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
- # <failed-install-package> <version> `removing'
- # <conflicting-package> <version>
- # for details, see http://www.debian.org/doc/debian-policy/ or
- # the debian-policy package
- #
- # quoting from the policy:
- # Any necessary prompting should almost always be confined to the
- # post-installation script, and should be protected with a conditional
- # so that unnecessary prompting doesn't happen if a package's
- # installation fails and the `postinst' is called with `abort-upgrade',
- # `abort-remove' or `abort-deconfigure'.
-
- case "$1" in
- configure)
- # add hplip system user (requires adduser >= 3.34)
- # don't muck around with this unless you KNOW what you're doing
- echo "Creating/updating hplip user account..."
- adduser --system --ingroup lp --home /var/run/hplip \
- --gecos "HPLIP system user" --shell /bin/false \
- --quiet --disabled-password hplip || {
- # adduser failed. Why?
- if getent passwd hplip >/dev/null ; then
- echo "Non-system user hplip found. I will not overwrite a non-system" >&2
- echo "user. Remove the user and reinstall hplip." >&2
- exit 1
- fi
- # unknown adduser error, simply exit
- exit 1
- }
- if getent group scanner >/dev/null; then
- adduser --quiet hplip scanner
- else
- addgroup --quiet --system scanner
- adduser --quiet hplip scanner
- fi
-
- for i in /var/run/hplip
- do
- if ! dpkg-statoverride --list $i > /dev/null
- then
- dpkg-statoverride --update --add hplip root 755 $i
- fi
- done
-
-
- # Remove shutdown and reboot links; this init script does not need them.
- if dpkg --compare-versions "$2" lt "0.9.11-2ubuntu3"; then
- rm -f /etc/rc0.d/K19hplip /etc/rc6.d/K19hplip
- fi
-
- # Correct ownership of personal HPLIP config files of the users
- # (in older HPLIP versions hp-setup created these files with root
- # permissions and made hp-toolbox crashing)
- for line in `cat /etc/passwd | sed -e 's/ //g'`; do
- user=`echo $line | cut -d : -f 1`;
- homedir=`echo $line | cut -d : -f 6`;
- [ -d $homedir ] && \
- find $homedir -maxdepth 1 -not -user $user -name .hplip* \
- -exec chown $user '{}' \; 2>/dev/null || :
- done
- ;;
-
- abort-upgrade|abort-remove|abort-deconfigure)
- ;;
-
- *)
- echo "postinst called with unknown argument \`$1'" >&2
- exit 1
- ;;
- esac
-
- # dh_installdeb will replace this with shell code automatically
- # generated by other debhelper scripts.
-
- # Automatically added by dh_installmenu
- if [ "$1" = "configure" ] && [ -x "`which update-menus 2>/dev/null`" ]; then
- update-menus
- fi
- # End automatically added section
- # Automatically added by dh_desktop
- if [ "$1" = "configure" ] && which update-desktop-database >/dev/null 2>&1 ; then
- update-desktop-database -q
- fi
- # End automatically added section
- # Automatically added by dh_pysupport
- if [ "$1" = "configure" ] && which update-python-modules >/dev/null 2>&1; then
- update-python-modules -i /usr/share/python-support/hplip
- fi
- # End automatically added section
- # Automatically added by dh_pysupport
- if [ "$1" = "configure" ] && which update-python-modules >/dev/null 2>&1; then
- update-python-modules -b hplip.dirs
- fi
- # End automatically added section
- # Automatically added by dh_installinit
- if [ -x "/etc/init.d/hplip" ]; then
- update-rc.d hplip defaults 19 >/dev/null
- if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then
- invoke-rc.d hplip start || exit $?
- else
- /etc/init.d/hplip start || exit $?
- fi
- fi
- # End automatically added section
-
-
- exit 0
-